﻿using System;
using System.IO;
using System.Threading;

using Haro.Speech;
using HaroModuleLib;

namespace Haro.Core
{
    internal class LoadedModule
    {
        private string m_sModuleFileName, m_sModuleBaseDirectory;
        private IModule m_Module;
        private Thread m_Thread;
        
        #region Accessors and Modifiers
        /// <summary>
        /// Gets the relative directory location of the module.
        /// </summary>
        public string ModuleFileLocation
        {
            get { return m_sModuleFileName; }
        }

        /// <summary>
        /// Gets the base directory address for the module.
        /// </summary>
        public string ModuleBaseDirectory
        {
            get { return m_sModuleBaseDirectory; }
        }

        /// <summary>
        /// Gets or sets the instance of the module used by this instance of LoadedModule.
        /// </summary>
        public IModule Module
        {
            get { return m_Module; }
            set { m_Module = value; }
        }

        /// <summary>
        /// Gets or sets the thread used by this module.
        /// </summary>
        public Thread Thread
        {
            get { return m_Thread; }
            set { m_Thread = value; }
        }
        #endregion

        #region Constructor
        /// <summary>
        /// Constructor for LoadedModule that initializes some properties regarding itself.
        /// </summary>
        /// <param name="FileAddress">The address of where the file containing the module is located.</param>
        public LoadedModule(string FileAddress)
        {
            m_sModuleFileName = FileAddress;
            int i = FileAddress.LastIndexOf(@"\");
            m_sModuleBaseDirectory = FileAddress.Substring(0, i);

        }
        #endregion
    }
}
